/*
	Robert Elliott
	relliott249@gmail.com

	ECEN 4013 Team 2: Bearshark
	
	This is the sudocode for the IR transmission for the Remote Control.
	It is very much based off the code for the Mage IR transmission code. 
	However, in order to prevent interference with the Mage IR protocols,
	we are working at a different frequency (33kHz) and different wavelength.
	
	Math:
		1/33,000 = 30.3us period -> 15us on, 15us off
		300us bit width, because I say so
		300/30 = 10 cycles per bit

	Musical Inspiration:
		Amputechture - The Mars Volta

*/

void rIRH(void)
{
	int i;	// counter variable
	
	for(i = 0; < 10; i++)
	{
		ir = HIGH; 		// turn on led
		delayus(15);	// delay 15us
		ir = LOW;		// turn off
		delayus(15);	// delay 15us
	}						// repeat 10 times

}	// end irHigh

void rIRL(void)
{
	ir = LOW			// turn off led
	delayus(30);	// delay 30us
}

void crystalActivate(void)
{
	int i;
	// Mage standards seem good enough, might as well follow them here
	// initial high bit to set ir reception
	rIRH();
	// then low bit
	rIRL();
	// Since all we do is activate the crystal I'll hard code a default number in
	for(i = 0; i < 4; i++)
	{
		rIRH();
		rIRL();
	}
	// activation signal will be 0xAA
	
	// high bit for even parity
	rIRH();
}	// end of crystalActivate
